package com.wiscamp.ninechapters.accounts.infrastructure.mappers;

import com.wiscamp.ninechapters.accounts.infrastructure.po.AccountPO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

@Component
public interface AccountMapper extends JpaRepository<AccountPO, Long>, JpaSpecificationExecutor<AccountPO> {

    @Query(value = "select e from AccountPO e where e.accountType = :accountType and e.userId = :userId")
    AccountPO getAccount(int accountType, long userId);
}